package com.jrauto.CarAppBackend.entity;

/**
 * @author : huiMing
 * Date : 2025年06月25日 11:02
 * @version V1.0
 */
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 *
 * @TableName users
 */
@TableName(value ="users")
public class User {
    /**
     * 用户ID，主键，自增
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 手机号，唯一，用作账户
     */
    private String phone;

    /**
     * 密码，通常需要加密存储
     */
    private String password;

    /**
     * 用户昵称
     */
    private String nickname;

    /**
     * 绑定的微信 OpenID
     */
    @TableField(value = "openid")
    private String openid;

    /**
     * 性别，1男、0女、2保密
     */
    private Integer gender;

    /**
     * 头像URL
     */
    private String avatar;

    /**
     * 邮箱，唯一
     */
    private String email;

    /**
     * 角色：车主(owner)，车商(dealer)，管理员(admin)
     */

    private Integer role;

    /**
     * 会员id
     */
    private String memberId;

    /**
     * 状态：0被锁定，1正常，2删除
     */
    private Integer status;

    /**
     * 更新时间
     */
    private Date updatedAt;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 格式化 JSON 输出的时间
    private Date createdAt;

    public User() {
    }


    public User(Integer id, String phone, String password, String nickname, String openid, Integer gender, String avatar, String email, Integer role, String memberId, Integer status, Date updatedAt, Date createdAt) {
        this.id = id;
        this.phone = phone;
        this.password = password;
        this.nickname = nickname;
        this.openid = openid;
        this.gender = gender;
        this.avatar = avatar;
        this.email = email;
        this.role = role;
        this.memberId = memberId;
        this.status = status;
        this.updatedAt = updatedAt;
        this.createdAt = createdAt;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    public String getMemberId() {
        return memberId;
    }

    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", phone='" + phone + '\'' +
                ", password='" + password + '\'' +
                ", nickname='" + nickname + '\'' +
                ", openid='" + openid + '\'' +
                ", gender=" + gender +
                ", avatar='" + avatar + '\'' +
                ", email='" + email + '\'' +
                ", role=" + role +
                ", memberId='" + memberId + '\'' +
                ", status=" + status +
                ", updatedAt=" + updatedAt +
                ", createdAt=" + createdAt +
                '}';
    }
}